import bg.cookbook.Locker;
import bg.cookbook.SlideCreator;
import bg.cookbook.SlideEvent;

import flash.events.Event;
import flash.events.MouseEvent;

import mx.events.FlexEvent;

import spark.effects.Fade;

protected function newSlide_clickHandler(event:MouseEvent):void
{
	
	var rect:Locker = new Locker();
	rect.width=100;
	rect.height=100;
	listOfSlides.addElementAt(rect, listOfSlides.numElements -1);
	fadeIn.play([rect]);
}
public function addSlides(slides:Vector.<Locker>):void
{
	for(var i:int=0; i<slides.length;i++)
	{
		slides[i].fit100();
		slides[i].edit();
		listOfSlides.addElementAt(slides[i],i);
	}
}

protected function group1_creationCompleteHandler(event:FlexEvent):void
{
	//				var rect:Locker = new Locker();
	//				rect.width=100;
	//				rect.height=100;
	//				listOfSlides.addElementAt(rect, listOfSlides.numElements -1);
	//				fadeIn.play([rect]);
	//				
	//				rect.autoSelect();
}

public function deselectAll(newSelectedLocker:Locker,slide:SlideCreator):void
{
	var l:Locker;
	for(var i:int = 0; i < listOfSlides.numElements - 1;i++)
	{
		l = Locker(listOfSlides.getElementAt(i));
		if(l != newSelectedLocker)
		{
			l.deselect(slide);
		}
	}
}
public function stSlideshow(event:MouseEvent):void
{
	this.dispatchEvent(new Event("startSlideshow"));
}
public function getAllSlides():Vector.<Locker>
{
	var arrSlide:Vector.<Locker>=new Vector.<Locker>;
	for(var i:int=0; i<(listOfSlides.numElements-1);i++)
	{
		var c:Locker=Locker(listOfSlides.getChildAt(i));
		c.preview();
		arrSlide.push(c);
	}
	return arrSlide;
	
}